from Redis import RedisClient
from remoteDB import ArticleDB

if __name__ == '__main__':
    remote_db = ArticleDB()
    r = RedisClient()
    start = 0
    while True:
        index, redis_data = remote_db.GetBatchPeriodicalError(start, 500)
        pipe = r.client.pipeline(transaction=True)
        for item in redis_data:
            pipe.lpush('periodical', item)
        pipe.execute()
        start = index
